package com.tianyu.model.enums;

import lombok.Getter;

import java.util.Arrays;

/**
 * @author swyan
 * @version 1.1
 * @date 2022/6/1
 */
@Getter
public enum ThirdMethodEnum {

    DOCK_LEDGER_INFO("DOCK_LEDGER_INFO", "机库", "台账信息"),
    AIRCRAFT_LEDGER_INFO("AIRCRAFT_LEDGER_INFO", "飞行器", "台账信息"),
    FLIGHT_LINES("FLIGHT_LINES", "飞行器", "航线列表"),
    DOCK_CAMERA_LIVE("DOCK_CAMERA_LIVE", "机库", "镜头：加载摄像头直播/推流"),
    AIRCRAFT_CAMERA_LIVE("AIRCRAFT_CAMERA_LIVE", "飞行器", "镜头：加载摄像头直播/推流"),
    TAKEOFF_TO_POINT("TAKEOFF_TO_POINT", "飞控", "一键起飞"),
    FLY_TO_POINT("FLY_TO_POINT", "飞控", "指点飞行"),
    FLIGHT_TASK("FLIGHT_TASK", "飞控", "任务飞行"),
    CAMERA_RESET("CAMERA_RESET", "云台", "镜头重置"),
    CAMERA_ZOOM_FOCAL("CAMERA_ZOOM_FOCAL", "云台", "变焦"),
    CAMERA_LENS("CAMERA_LENS", "云台", "镜头类型切换"),
    CAMERA_QUALITY("CAMERA_QUALITY", "云台", "镜头清晰度切换"),
    CAMERA_AIM("CAMERA_AIM", "云台", "视觉中心点切换"),
    HOVER("HOVER", "飞控", "悬停"),
    CONTINUE_FLIGHT("CONTINUE_FLIGHT", "飞控", "继续飞行"),
    RETURN_HOME("RETURN_HOME", "飞控", "返航"),
    MANUAL_JOYSTICK("MANUAL_JOYSTICK", "手控", "摇杆操作"),

    UNKNOWN("Unknown", "unknown", "unknown");

    private final String method;

    private final String target;

    private final String desc;

    ThirdMethodEnum(String method, String target, String desc) {
        this.method = method;
        this.target = target;
        this.desc = desc;
    }

    public static ThirdMethodEnum findByMethod(String method) {

        if (method == null || "".equals(method)) {
            System.out.println(method);
            return UNKNOWN;
        }
        return Arrays.stream(ThirdMethodEnum.values())
                .filter(thirdMethodEnum -> thirdMethodEnum.method.equals(method))
                .findAny()
                .orElse(UNKNOWN);
    }
}
